package com.example.questionnaire.mbg.service.impl;

import com.example.questionnaire.mbg.entity.Answer;
import com.example.questionnaire.mbg.mapper.AnswerMapper;
import com.example.questionnaire.mbg.service.IAnswerService;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Primary
@Service
public class AnswerServiceImpl implements IAnswerService {

    @Resource
    private AnswerMapper answerMapper;

    @Override
    public int insertAnswer(Answer answer) {
        answerMapper.insertAnswer(answer);
        int answerId = answer.getId();
        return answerId;
    }

    @Override
    public List<Answer> getAnByQnid(int qnid) { return answerMapper.getAnByQnid(qnid); }

    @Override
    public Answer getAnByQnidandUid(int qnid, int uid) { return answerMapper.getAnByQnidandUid(qnid, uid); }
}